package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface SetmealDishMapper {



    /**
     *判断是否关联了套餐
     */
    List<Long> coutByDishIds(List<Long> ids);

    /**
     * 批量插入
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据菜品id删除套餐菜品关系
     * @param ids
     */
    void deleteBySetmealId(List<Long> ids);


    /**
     * 根据套餐id查询套餐和菜品的关联关系
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealId);


    /**
     * 根据菜品id查询起售菜品关联的套餐数量
     * @param setmealDishes
     * @return
     */
    Long countByEnableCategoryId(@Param("list") List<SetmealDish> setmealDishes);
}
